package ${classPath};

import java.time.LocalDateTime;
import java.util.Map;

import javax.validation.constraints.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.enums.Publish;
import com.ruoyi.common.utils.BeanUtils;
import com.ruoyi.game.query.${domain}Query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
@ApiModel(value = "${classComment}对象查询")
public class ${domain}QueryCommand {
<#list fieldList as field>


<#compress>
  /** ${field.comment} */<#list field.annotations as annotation> <#--内层循环-->
<#if field.name!="id">
  <#if !annotation?starts_with("@Co")&&!annotation?starts_with("@E")>
    ${annotation}
  </#if>
</#if>
</#list>
  @ApiModelProperty(value = "${field.comment}")
  private ${field.type} ${field.name};
</#compress>
</#list>

	/** 请求参数 */
	// beginCreateTime
	// endCreateTime
	@ApiModelProperty(value = "状态-是否发布")
	private Map<String, Object> params;

	public ${domain}Query convert() {
		${domain}Query query = new ${domain}Query();
		BeanUtils.copyPropertiesIgnoreNull(this, query);
		
    LocalDate beginCreateTime = null;
    if(params!=null && params.containsKey("beginCreateTime"))
    {
      beginCreateTime = LocalDate.parse(String.valueOf(params.get("beginCreateTime")));
    }
    LocalDate endCreateTime = null;
    if(params!=null && params.containsKey("endCreateTime"))
    {
      endCreateTime = LocalDate.parse(String.valueOf(params.get("endCreateTime")));
    }
    LocalDateRange createTime = new LocalDateRange(beginCreateTime, endCreateTime);
    query.setCreateTime(createTime);
	
		return query;
	}
}